<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/22
 * Time: 20:29
 */
class User_token_model extends CI_Model{
    /**
     * User_model constructor.
     * 构造方法，加载数据库
     */
    public function __construct() {
        $this->load->database();
    }
    public function update($data){
        $this->db->update('user_token',$data,array('user_id'=>$data['user_id']));
    }
    public function findByIp($ip){
        $query= $this->db->get_where('user_token',array('ip'=>$ip));
        return $query->row_array();
    }
    public function findById($id){
        $query= $this->db->get_where('user_token',array('user_id'=>$id));
        return $query->row_array();
    }
    public function insert($data){
       $this->db->insert('user_token',$data);
    }
}